package com.ngc.mall.vo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.ngc.mall.domain.CategoryDomain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 *
 * 个人优惠券
 * @author: chenxiaolin
 * @date 2023/10/11 23:00
**/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class UserCouponVO {
    private String userName;

    private Long userId;

    private Long id;

    private String name;

    /**
     * 优惠金额
     */
    private BigDecimal fullMoney;
    /**
     * 满减金额
     */
    private BigDecimal minus;

    /**
     * 折扣
     */
    private BigDecimal rate;

    /**
     * 优惠券类型 (1 折扣券 2满减券 3.无门槛券 4.满折券）
     */
    private Integer type;


    private String description;
    /**
     * 是否为全场券 0 否（商品券） 1 是
     */
    private Boolean wholeStore;

    /**
     * 生效时间
     */
    private LocalDateTime startDate;

    /**
     * 失效时间
     */
    private LocalDateTime endDate;

    @TableField(exist =false)
    List<CategoryDomain> categoryList;


    public void setCategoryList(List<CategoryDomain> categoryList) {
        if(categoryList.isEmpty()){
            return;
        }
        this.categoryList = categoryList;
    }
}
